Packet sending method, network node, and system

ABSTRACT

A controller obtains a forwarding latency requirement of a service flow and a destination address of the service flow, and determines a forwarding path that meets the forwarding latency requirement. The controller determines that an ingress node forwards a first cycle time number of a packet and an intermediate node forwards a second cycle time number of the packet, and separately determines a corresponding adjacent segment identifier. A label stack generated by the controller includes the adjacent segment identifier and the adjacent segment identifier. The controller sends the label stack to the ingress node, to trigger the ingress node to forward the packet within a period of time corresponding to the first cycle time number. The controller determines the forwarding path based on the forwarding latency requirement of the service flow, and generates a label stack corresponding to a forwarding time point.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.17/035,687, filed on Sep. 29, 2020, which is a continuation ofInternational Application No. PCT/CN2019/079787, filed on Mar. 27, 2019,which claims priority to Chinese Patent Application No. 201810273967.5,filed on Mar. 29, 2018. All of the aforementioned patent applicationsare hereby incorporated by reference in their entireties.

TECHNICAL FIELD

The present invention relates to the communications field, and inparticular, to a packet sending method, a network node, and a system.

BACKGROUND

Deterministic networking (deterministic networking, DetNet) can providea highly reliable path for an application. The deterministic networkingcan provide a bounded latency guarantee and an ultra low packet lossrate. Abounded latency guarantee means that in an end-to-end packetforwarding process, a packet forwarding latency is within a fixed andrequired range. In other words, the packet forwarding latency needs tobe within the latency range. A bounded latency is implemented throughend-to-end reserved bandwidth resources and a queue managementalgorithm. Circular queue and forwarding (cyclic queuing and forwarding,CQF) is a queue management method that is applied to deterministicnetworking in a prior art. A core of the CQF technology is that a packetis sent within a cycle time (cycle time) of a node A on a forwardingpath, the packet is received within a same cycle time of a next-hop nodeof the node, and the packet is sent in a next cycle time of the next-hopnode. Therefore, a maximum latency per hop is one cycle time, and amaximum end-to-end latency is (N+1)×cycle time, where N is a quantity ofintermediate nodes on a forwarding path that a packet passes through.However, because there is a link latency, a packet may be sent at ann^(th) cycle time of a node, and may be received at an (n+1)^(th) cycletime of a next-hop node. Therefore, CQF cannot accurately provide adeterministic latency guarantee during packet forwarding.

SUMMARY

This application provides a packet sending method, a network node, and asystem, to accurately provide a latency guarantee during packetforwarding.

According to a first aspect, an embodiment of the present inventionprovides a packet sending method, where the method includes: obtaining,by a controller, a forwarding latency requirement of a service flow anda destination address of the service flow, and determining, based on theforwarding latency requirement and the destination address, a forwardingpath for forwarding the service flow, where a latency of the forwardingpath meets the forwarding latency requirement of the service flow, theforwarding path passes through a first network node and a second networknode, the first network node is an ingress node of the forwarding path,and the second network node is an intermediate node of the forwardingpath; determining, by the controller, a first cycle time number at whichthe first network node forwards a packet and a second cycle time numberat which the second network node forwards the packet, and determining afirst adjacent segment identifier corresponding to the first cycle timenumber and a second adjacent segment identifier corresponding to thesecond cycle time number, where the packet belongs to the service flow;generating, by the controller, a label stack, where the label stackincludes the first adjacent segment identifier and the second adjacentsegment identifier; and sending, by the controller, the label stack tothe first network node, where the label stack is used to indicate thefirst network node to forward the packet via the forwarding path withina period of time corresponding to the first cycle time number.

According to the foregoing technical solution, the controller determinesthe forwarding path based on the forwarding latency requirement of theservice flow, and separately determines the cycle time numbercorresponding to a forwarding time point of the ingress node and thecycle time number corresponding to a forwarding time point of theintermediate node, where the ingress node and the intermediate node areon the forwarding path. Then, the controller generates the correspondinglabel stack. The adjacent segment identifier in the label stack iscorresponding to the cycle time number at which the node forwards thepacket. In this way, the ingress node and the intermediate node of theforwarding path may forward, at a determined time point based on thelabel stack, the packet that belongs to the service flow, so that adeterministic latency guarantee can be provided during packetforwarding.

In a possible design, the packet is a first packet in the service flow,or any packet in the service flow.

In a possible design, the controller obtains a node latency of the firstnetwork node and a node latency of the second network node, where thenode latency includes a packet processing latency and a packet sendinglatency. The controller obtains a link latency of a link on theforwarding path. That a latency of the forwarding path meets theforwarding latency requirement of the packet includes: a sum of the nodelatency of the first network node, the node latency of the secondnetwork node, and the link latency of the link on the forwarding pathfalls within a range of the forwarding latency requirement of thepacket.

In a possible design, the latency of the forwarding path is equal to thesum of the node latency of the first network node, the node latency ofthe second network node, and the link latency of the link on theforwarding path.

In a possible design, the controller obtains cycle time duration of thefirst network node and cycle time duration of the second network node;the controller obtains a third cycle time number of the first networknode and a fourth cycle time number of the second network node that arecorresponding to a current time point of the controller; the controllerdetermines the first cycle time number based on the cycle time durationof the first network node and the third cycle time number, where a starttime point corresponding to the first cycle time number is after thefirst network node receives the label stack; and the controllerdetermines the second cycle time number based on the cycle time durationof the first network node, a link latency between the first network nodeand the second network node, the packet processing latency of the secondnetwork node, the third cycle time number, and the cycle time durationof the second network node.

In a possible design, the controller receives a notification packet sentby the first network node, where the notification packet includes theforwarding latency requirement and the destination address of thepacket.

According to a second aspect, an embodiment of the present inventionprovides a packet sending method, where the method includes: obtaining,by a first network node, a packet; obtaining, by the first network node,a first label stack based on the packet, where the first label stack isa label stack corresponding to a forwarding path for forwarding thepacket, the first label stack includes an adjacent segment identifier ofthe first network node and an adjacent segment identifier of a secondnetwork node, the first network node is an ingress node of theforwarding path, and the second network node is an intermediate node ofthe forwarding path; pushing, by the first network node, the first labelstack into the packet, where a top of the first label stack is theadjacent segment identifier of the first network node; determining, bythe first network node based on the adjacent segment identifier of thefirst network node, a cycle time number at which the packet isforwarded; popping out, by the first network node, the adjacent segmentidentifier that is of the first network node and that is in the firstlabel stack, to obtain a second label stack; and sending, by the firstnetwork node to the second network node within a period of timecorresponding to the cycle time number, the packet including the secondlabel stack.

In this technical solution, after obtaining the packet, the firstnetwork node obtains the first label stack based on the packet, anddetermines, based on the adjacent segment identifier that is included inthe label stack and that is corresponding to the first network node, thecorresponding cycle time number at which the first packet is forwarded.Then, the first network node sends the packet to a next hop of the firstnetwork node within the period of time corresponding to the cycle timenumber, so that the first network node sends the packet at a determinedtime point. This facilitates that a deterministic latency guarantee isprovided during packet forwarding.

In a possible design, the first network node obtains a service flow, andsends a forwarding latency requirement of the service flow and adestination address of the service flow to a controller, to trigger thecontroller to determine, based on the forwarding latency requirement andthe destination address, a forwarding path for forwarding the serviceflow and a label stack corresponding to the forwarding path, where thepacket is a packet in the service flow. The first network node receivesthe label stack that is sent by the controller and that is correspondingto the forwarding path.

In a possible design, the first network node obtains the first labelstack based on the label stack that is sent by the controller and thatis corresponding to the forwarding path. Specifically, the first networknode adds, according to a packet sending rate, N to each label that iscorresponding to the forwarding path and that is in the label stack toobtain the first label stack, where N is a sequence number of a sentpacket minus 1.

In a possible design, the sending, by the first network node to thesecond network node within a period of time corresponding to the cycletime number, the packet including the second label stack includes:adding, by the first network node, the packet including the second labelstack to a packet queue corresponding to the cycle time number, and whenthe packet queue is a sending queue, sending the packet including thesecond label stack to the second network node through an outboundinterface corresponding to the adjacent segment identifier of the firstnetwork node.

According to a third aspect, an embodiment of the present inventionprovides a packet sending method, where the method includes: receiving,by a second network node, a first packet sent by a first network node,where the packet includes a label stack; obtaining, by the secondnetwork node, a top of the label stack; determining that the top of thelabel stack is an adjacent segment identifier of the second networkdevice, and determining, according to a stored correspondence between anadjacent segment identifier and a cycle time number, a cycle time numbercorresponding to the adjacent segment identifier; and popping out, bythe second network node, the adjacent segment identifier that is of thesecond network node and that is in the label stack of the first packet,to generate a second packet, and sending the second packet to a next-hopnetwork node of the second network node within a period of timecorresponding to the cycle time number.

In a possible design, the sending, by the first network node, the secondpacket to a next-hop network node of the first network node within aperiod of time corresponding to the cycle time number includes: adding,by the second network node, the second packet to a packet queuecorresponding to the cycle time number, and when the packet queue is asending queue, sending the second packet to the next-hop network node ofthe first network node through an outbound interface corresponding tothe adjacent segment identifier of the second network node.

According to a fourth aspect, an embodiment of the present inventionprovides a controller configured to perform the method in any one of thefirst aspect or the possible implementations of the first aspect.Specifically, the controller includes a unit configured to perform themethod in any one of the first aspect or the possible implementations ofthe first aspect.

According to a fifth aspect, an embodiment of the present inventionprovides a first network node configured to perform the method in anyone of the second aspect or the possible implementations of the secondaspect. Specifically, the first network node includes a unit configuredto perform the method in any one of the second aspect or the possibleimplementations of the second aspect.

According to a sixth aspect, an embodiment of the present inventionprovides a second network node configured to perform the method in anyone of the third aspect or the possible implementations of the thirdaspect. Specifically, the second network node includes a unit configuredto perform the method in any one of the third aspect or the possibleimplementations of the third aspect.

According to a seventh aspect, a controller is provided. The controllerincludes a processor, a network interface, and a memory. The memory maybe configured to store program code. The processor is configured toinvoke the program code in the memory to perform the method in any oneof the first aspect or the possible implementations of the first aspect.For details, refer to the detailed descriptions in the method examples.Details are not described herein again.

According to an eighth aspect, a first network node is provided. Thefirst network node includes a processor, a network interface, and amemory. The memory may be configured to store program code. Theprocessor is configured to invoke the program code in the memory toperform the method in any one of the second aspect or the possibleimplementations of the second aspect. For details, refer to the detaileddescriptions in the method examples. Details are not described hereinagain.

According to a ninth aspect, a second network node is provided. Thesecond network node includes a processor, a network interface, and amemory. The memory may be configured to store program code. Theprocessor is configured to invoke the program code in the memory toperform the method in any one of the third aspect or the possibleimplementations of the third aspect. For details, refer to the detaileddescriptions in the method examples. Details are not described hereinagain.

According to a tenth aspect, a packet sending system is provided. Thesystem includes the controller, the first network node, and the secondnetwork node that are provided in the foregoing aspects.

According to an eleventh aspect, a computer storage medium is provided.The computer storage medium is configured to store a computer softwareinstruction used by the foregoing network node or controller, and thecomputer software instruction includes a program designed to perform theforegoing aspects.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic diagram of packet forwarding through CQF accordingto an embodiment of the present invention;

FIG. 2 is a schematic diagram of an application scenario of packetforwarding according to an embodiment of the present invention;

FIG. 3 is a schematic flowchart of packet forwarding according to anembodiment of the present invention;

FIG. 4 is a schematic diagram of a correspondence between a segmentidentifier and a cycle time number according to an embodiment of thepresent invention;

FIG. 5A and FIG. 5B are a schematic flowchart of packet forwardingaccording to an embodiment of the present invention;

FIG. 6 is a schematic diagram of a packet queue according to anembodiment of the present invention;

FIG. 7 is a schematic structural diagram of a controller according to anembodiment of the present invention;

FIG. 8 is a schematic structural diagram of a controller according to anembodiment of the present invention;

FIG. 9 is a schematic structural diagram of a first network nodeaccording to an embodiment of the present invention;

FIG. 10 is a schematic structural diagram of a first network nodeaccording to an embodiment of the present invention;

FIG. 11 is a schematic structural diagram of a second network nodeaccording to an embodiment of the present invention;

FIG. 12 is a schematic structural diagram of a second network nodeaccording to an embodiment of the present invention; and

FIG. 13 is a schematic diagram of a packet forwarding system accordingto an embodiment of the present invention.

DESCRIPTION OF EMBODIMENTS

The following describes the embodiments of the present invention withreference to accompanying drawings.

CQF is a queue management method that uses two queues to send a packetalternately. Each network node has an independent period of time forsending a packet. Packets in a same period of time are guaranteed withsufficient bandwidth through resource reservation, and packets indifferent periods of time are isolated. A packet has a deterministiclatency when being forwarded by each network node. As shown in FIG. 1 ,each network node has two packet queues: a packet receiving queue and apacket sending queue. The packet receiving queue is used to receive apacket sent by a previous-hop network node to a current network node.The packet sending queue is used to send the cached packet to a next-hopnetwork node, and the queue may not receive the packet or may receivethe packet. The packet receiving queue and the packet sending queue mayexchange roles. When the packet receiving queue changes into the packetsending queue, the packet received by the packet receiving queue is sentto the next-hop network node. Each network node has a clock. The packetreceiving queue and the packet sending queue exchange the roles after afixed-length period of time. In other words, the packet receiving queuechanges into the packet sending queue, and the packet sending queuechanges into the packet receiving queue. The fixed-length period of timeis defined as a cycle time that is referred to as a cycle for short. Thenetwork node records a period of time in cycles. A length of the cycleof each network node is the same, and a start time point and an end timepoint of cycles of different network nodes need to be the same. Thepacket receiving queue and the packet sending queue exchange the rolesat an interval of cycles.

Referring to FIG. 1 , FIG. 1 is a schematic diagram of packet forwardingperformed by a network node through CQF. In a cycle 1, a packet sendingqueue of a node 101 sends a packet to a packet receiving queue of a node102. When a period of time changes from the cycle 1 to a cycle 2, thepacket receiving queue of the node 102 changes to the packet sendingqueue. In the cycle 2, the packet sending queue of the node 102 sendsthe packet to the packet receiving queue of a node 103. In the processin which the packet is forwarded from the node 101 to the node 103, amaximum packet forwarding latency is (N+1)×cycle, where N is a quantityof intermediate nodes on a forwarding path. In a scenario shown in FIG.1 , the packet forwarding latency is 2×cycle when the packet isforwarded from the node 101 to the node 103. Because impact of a linkbetween nodes is not considered in the process of calculating the packetforwarding latency, the manner of obtaining the maximum packetforwarding latency is inaccurate. For example, when the packet isforwarded by the node 101 to the node 102 in the cycle 1, and if a linklatency between the node 101 and the node 102 is greater than a lengthof one cycle, in this case, it cannot be ensured that the packet isforwarded to the node 102 within the cycle 1. Therefore, the CQF cannotaccurately provide a deterministic latency guarantee during packetforwarding.

FIG. 2 is a schematic diagram of a network scenario of a packet sendingmethod according to an embodiment of the present invention. Theapplication scenario includes: a controller 200, a transmit end 201, areceive end 206, a network node 202, a network node 203, a network node204, and a network node 205. The controller 200 is a controller in asoftware-defined network (software defined network, SDN) architecture,and is configured to implement traffic control and manage nodes in anetwork. In the scenario shown in FIG. 2 , the controller 200 controlsand manages the network node 202, the network node 203, the network node204, and the network node 205. A network in which the network node 202,the network node 203, the network node 204, and the network node 205 arelocated is a segment routing (segment routing, SR) network, and thenetwork node 202, the network node 203, the network node 204, and thenetwork node 205 all support an SR function. The transmit end 201 andthe receive end 206 may be user equipments, for example, a mobile phoneor a personal computer. The network node 202, the network node 203, thenetwork node 204, and the network node 205 may be routers, switches, orthe like. A link between the network node 202 and the network node 203is a link 1, a link between the network node 203 and the network node204 is a link 2, a link between the network node 202 and the networknode 204 is a link 3, and a link between the network node 204 and thenetwork node 205 is a link 4.

In the embodiments of the present invention, the network node may be aspecific network device, for example, a router or a switch.

With reference to the network scenario shown in FIG. 2 , referring toFIG. 3 , an embodiment of the present invention provides a packetsending method. The method includes the following steps.

S301: A controller receives a node latency of a network node in anetwork and a link latency in the network. The node latency includes apacket processing latency and a packet sending latency of the node. Forexample, the controller 200 separately receives a node latency of thenetwork node 202, the network node 203, the network node 204, and thenetwork node 205. The link latency includes a latency between networknodes in the network, for example, latencies of a link 1, a link 2, alink 3, and a link 4 in FIG. 2 .

In an example, the packet processing latency of the network node is anaverage processing latency or a maximum processing latency of aprocessed packet. The packet sending latency is an average sendinglatency or a maximum sending latency of a packet sent by the networknode. The link latency of the link 1 is an average forwarding latency ora maximum forwarding latency at which a packet is forwarded from thenetwork node 202 to the network node 203; the link latency of the link 2is an average forwarding latency or a maximum forwarding latency atwhich the packet is forwarded from the network node 203 to the networknode 204; the link latency of the link 3 is an average forwardinglatency or a maximum forwarding latency at which the packet is forwardedfrom the network node 202 to the network node 204; and the link latencyof the link 4 is an average forwarding latency or a maximum forwardinglatency at which the packet is forwarded from the network node 204 tothe network node 205.

S302: The controller obtains a forwarding latency requirement of aservice flow and a destination address of the service flow. The serviceflow is a service flow that is forwarded through the network managed bythe controller. In the scenario shown in FIG. 2 , a packet in theservice flow needs to be forwarded through the SR network.

In an example, the forwarding latency requirement of the service flowand the destination address of the service flow may be sent by aningress node of the SR network to the controller. For example, thenetwork node 202 in FIG. 2 sends, to the controller 200, the destinationaddress of the service flow and the latency requirement of the serviceflow that needs to be forwarded.

In an example, the forwarding latency requirement of the service flowand the destination address of the service flow may be sent by theaccess end 201 to the controller. When needing to send the service flowthrough the network managed by the controller, the access end 201 sendsthe forwarding latency requirement of the service flow and thedestination address of the service flow to the controller.

In an example, the forwarding latency requirement of the service flowmay be a latency range. For example, the latency requirement is that apacket forwarding latency ranges from 10 milliseconds (ms) to 15 ms, orthe forwarding latency requirement is a specific latency, for example,the forwarding latency is 20 ms.

S303: The controller calculates a forwarding path based on thedestination address of the service flow, where a latency of theforwarding path meets the forwarding latency requirement of the serviceflow. The forwarding path includes an ingress node, an intermediatenode, and an egress node. The latency of the forwarding path includes anode latency of the ingress node of the forwarding path, a node latencyof the intermediate node, and a link latency of a link between theingress node and the egress node.

With reference to FIG. 2 , for example, the destination address of theservice flow is an address of the receive end 206, and the controller200 calculates the forwarding path in the SR network based on thedestination address. There are two paths that can reach the receive end206: a path 1 and a path 2. The path 1 passes through the network node202, the network node 203, and the network node 205, and the path 2passes through the network node 202, the network node 204, and thenetwork node 205. If a latency of the path 1 meets the forwardinglatency requirement of the service flow, and a latency of the path 2does not meet the forwarding latency requirement of the service flow,the controller selects the path 1 as the forwarding path for forwardingthe service flow. An ingress node of the path 1 is the network node 202,an intermediate node of the path 1 is the network node 203, and anegress node of the path 1 is the network node 205.

S304: The controller obtains cycle time duration of an ingress node ofthe forwarding path and a cycle time number of the ingress node at acurrent time point of the controller. In the embodiments of thisapplication, the cycle time duration is duration occupied by the cycletime. The current time point of the controller is a time point at whichthe controller obtains the cycle time number of the ingress node.

S305: The controller obtains cycle time duration of an intermediate nodeof the forwarding path and a cycle time number of the intermediate nodeat a current time point of the controller. There may be one or moreintermediate nodes. The current time point of the controller is a timepoint at which the controller obtains the cycle time number of theintermediate node.

Cycle time duration of each network node may be the same or may bedifferent. This is not specifically limited in the embodiments of thisapplication. A cycle time is a unit of process scheduling of a networknode, and sending of a packet in a queue is completed once in one cycletime. The cycle time of each network node is numbered starting from atime point when the network node is started, and increases gradually. Itcan be learned that in the embodiments of the present invention, thecycle time duration of each network node may be the same or may bedifferent, and a start time point and an end time point of the cycletime of each network node may be different. This avoids configurationcomplexity of the network node, simplifies device management workloads,and provides high packet forwarding efficiency.

With reference to FIG. 2 , for example, cycle time duration of thenetwork node 202 and cycle time duration of the network node 203 areseparately obtained by the controller. The cycle time duration of thenetwork node 202 is first duration, for example, 10 milliseconds (ms),and the cycle time duration of the network node 203 is second duration,for example, 12 ms. A current cycle time number of the network node 202is a first number, for example, 124, and a current cycle time number ofthe network node 203 is a second number, for example, 156.

S306: The controller determines a cycle time number at which the ingressnode sends a packet, and determines a cycle time number at which theintermediate node sends the packet, where the packet belongs to theservice flow. Optionally, the packet may be a first packet in theservice flow, or any packet in the service flow.

After obtaining the cycle time duration and the current cycle timenumber of the ingress node, the controller may select a time point as atime point at which the ingress node sends the packet, and determine acycle time number corresponding to the time point. For example, thecurrent cycle time number of the ingress node is k, for example, k=1001,and the cycle time duration is m, for example, m=10 ms. The controllerchooses to wait t seconds before allowing the ingress node to start tosend the packet, for example, t=50 seconds. The cycle time number Lcorresponding to sending of the packet is calculated according to thefollowing formula:

L=k+t×1000/m.

That is, L=1001+50×1000/10=6001.

The t seconds may be obtained from a time point of calculating thewaiting t seconds by the controller and a time point at the controllerat which the ingress node forwards the packet.

After determining the cycle time number of the ingress node, thecontroller determines the cycle time number of the intermediate node.The controller determines a cycle time number of a first intermediatenode of the forwarding path, where the first intermediate node is anext-hop node of the ingress node. For example, in FIG. 2 , if the node202 is the ingress node, the node 203 is the next-hop node of the node202. The controller calculates the cycle time number of the firstintermediate node in the following manner.

Duration t of the packet before the intermediate node enqueues iscalculated according to the following formula:

t=t1+t2+t3.

-   -   t1 is a time length when the packet is forwarded by the ingress        node at the cycle time number L;    -   t2 is a link latency of a link between the ingress node and the        intermediate node; and    -   t3 is a maximum packet processing latency of the intermediate        node.

Based on the duration t before enqueue the packet at the intermediatenode, a number of cycle time when last enqueue the packet at theintermediate node is calculated. For example,

-   -   a current cycle time number of the intermediate node is a, for        example, a=2001, cycle time duration is m, for example, m=20 ms,        and the foregoing calculated latest enqueuing duration t of the        intermediate node is 20 seconds. A cycle time number B        corresponding to sending the packet by the corresponding        intermediate node is calculated according to the following        formula:

B=a+t×1000/m=3001.

The controller calculates, in the following manner, a cycle time numberof an intermediate node (a non-first intermediate node) other than thefirst intermediate node.

Duration t of the packet before the non-first intermediate node enqueuesis calculated according to the following formula:

t=t1+t2+t3+t4.

-   -   t1 is the time length when the packet is forwarded by the        ingress node at the cycle time number L;    -   t2 is a link latency of a link between the ingress node and the        non-first intermediate node;    -   t3 is a maximum packet processing latency of the non-first        intermediate node; and t4 is a sum of node latencies of        intermediate nodes that are between the ingress node and the        non-first intermediate node.

S307: Determine an adjacent segment identifier of the ingress node,determine an adjacent segment identifier of the intermediate node, andgenerate a label stack. The label stack sequentially includes, from topof the stack to bottom of the stack, the adjacent segment identifier ofthe ingress node and the adjacent segment identifier of the intermediatenode.

S308: The controller sends the label stack to the ingress node.

In an example, an outbound interface of each node of the forwarding pathmay be corresponding to a plurality of adjacent segment identifiers, anda correspondence between each adjacent segment identifier and a cycletime number is established. Referring to FIG. 4 , for example, adjacentsegment identifiers corresponding to an outbound interface of theingress node of the forwarding path are from SID 1 to SID 10. The 10adjacent segment identifiers are corresponding to a link that iscorresponding to an outbound interface and that is forwarded by theingress node via the forwarding path, for example, the link 1 in FIG. 2. Each segment identifier (segment identifier, SID) of a port iscorresponding to a plurality of cycle numbers, and a SID correspondingto the port or the link may also be referred to as an adjacent segmentidentifier. The SID may be an MPLS label. To limit a quantity of SIDs,on a premise that no confusion is caused, a correspondence between acycle number and a SID may be a many-to-one correspondence. For example,cycle numbers corresponding to the SID 1 is M, where M is an arithmeticsequence whose first term is 0001 and whose common difference is 10. Forexample, the cycle numbers corresponding to the SID 1 are 0001, 0011,0021, 0031, and the like. Cycle numbers corresponding to the SID 2 is N,where N is an arithmetic sequence whose first term is 0002 and whosecommon difference is 10. For example, the cycle numbers corresponding tothe SID 2 are 0002, 0012, 0022, 0032, and the like. In this embodimentof the present invention, 10 SIDs may be used to represent cyclenumbers. Cycle numbers on a node increase as a time elapses, and SIDsused for every 10 cycle numbers are cyclically used.

In an example, after a correspondence between each adjacent segmentidentifier and cycle numbers is established, the ingress node and theintermediate node separately send the correspondence to the controller,or the controller may actively obtain the correspondence between anadjacent segment identifier and cycle numbers from each forwarding node.

The controller may determine, based on the calculated cycle time numberof each node and the correspondence between an adjacent segmentidentifier and cycle numbers, SIDs that need to be used, and then form alabel stack by using the SIDs of each node. The label stack sequentiallyincludes, from top of the stack to bottom of the stack, SIDs of theingress node and the intermediate node of the forwarding path. Forexample, with reference to FIG. 2 , the packet passes through the node202 and the node 203 to arrives at the node 205, and a label stack is<SID 2, SID 4>, where the SID 2 is an adjacent segment identifier of thenode 202, and the SID 4 is an adjacent segment identifier of the node203. In this embodiment of the present invention, different nodes mayuse a same adjacent segment identifier. In other words, an adjacentsegment identifier of a node is locally valid. For example, the adjacentsegment identifiers corresponding to the outbound interface of theingress node of the forwarding path are from SID 1 to SID 10, andadjacent segment identifiers corresponding to an outbound interface ofthe intermediate node of the forwarding path may also be from SID 1 toSID 10. Corresponding to the scenario shown in FIG. 2 , adjacent segmentidentifiers of the link 1 corresponding to an outbound interface of thenode 202 are from SID 1 to SID 10, and adjacent segment identifiers ofthe link 2 corresponding to an outbound interface of the node 203 mayalso be from SID 1 to SID 10. The controller sends the label stack tothe ingress node, and after receiving the label stack, the ingress nodeperforms processing according to step S309.

S309: The ingress node forwards the packet based on the label stack.

The ingress node pushes the label stack into a packet header of aservice packet, where the service packet is a packet in the serviceflow. When it is determined that a top of the label stack is theadjacent segment identifier of the ingress node, a cycle time number atwhich the service packet is sent is determined according to thecorrespondence between an adjacent segment identifier and a cycle timenumber, and then the top is popped out. A service packet includingremaining labels in the label stack is sent to the intermediate nodewithin a period of time corresponding to the cycle time number. Forexample, when determining that the top of the label stack is the SID 2,the ingress node determines corresponding cycle time numbers based onthe SID 2. For example, if the determined cycle time numbers are 0002,0012, 0022, 0032, and the like, a cycle time number closest to a currentcycle time number of the ingress node is selected as the cycle timenumber at which the service packet is sent. For example, if the currentcycle time number of the ingress node is 0030, the selected cycle timenumber is 0032. After determining the cycle time number at which theservice packet is sent, the ingress node adds the service packet to apacket queue corresponding to the cycle time number. The packet queuemay be a packet receiving queue or a packet sending queue.

In an example, after the ingress node adds the service packet to thepacket queue corresponding to the cycle time, and when the packet queueis the sending queue, the service packet is sent to a next-hop node ofthe ingress node through an outbound interface corresponding to theadjacent segment identifier of the ingress node.

With reference to the network scenario shown in FIG. 2 , referring toFIG. 5A and FIG. 5B, an embodiment of the present invention provides apacket sending method. The method includes the following steps.

S501: A first network node obtains a forwarding latency requirement of aservice flow and a destination address of the service flow. The serviceflow is a service flow generated by the first network node, or is aservice flow received by the first network node from another device. Thefirst network node is an ingress node of the forwarding path, forexample, the ingress node in the embodiment shown in FIG. 3 .

S502: The first network node sends the forwarding latency requirement ofthe service flow and the destination address of the service flow to acontroller, to trigger the controller to determine, based on theforwarding latency requirement and the destination address, a forwardingpath for forwarding the service flow and a first label stackcorresponding to the forwarding path.

S503: The first network node receives the first label stack that is sentby the controller and that is corresponding to the forwarding path,where the first label stack includes an adjacent segment identifier ofthe first network node and an adjacent segment identifier of a secondnetwork node, and the second network node is an intermediate node of theforwarding path. For example, the intermediate node is the intermediatenode shown in the embodiment in FIG. 3 .

S504: The first network node pushes the first label stack into a packetheader of a first packet, where a top of the first label stack is anadjacent segment identifier of the first network node; and the firstnetwork node determines, based on the adjacent segment identifier of thefirst network node, cycle time number for sending the first packet. Thefirst packet is a packet in the service flow.

S505: The first network node pops out the adjacent segment identifierthat is of the first network node and that is in the first label stackin the packet header of the first packet, to generate a second packet.The first label stack from which the adjacent segment identifier of thefirst network node is popped out is a second label stack.

S506: The first network node sends the second packet to the secondnetwork node within a period of time corresponding to the cycle timenumber.

S507: The second network node receives the second packet, determinesthat a top that is of a second label stack and that is included in thesecond packet is the adjacent segment identifier of the second networkdevice, and determines, according to a stored correspondence between anadjacent segment identifier and a cycle time number, cycle timecorresponding to the adjacent segment identifier.

S508: The second network node pops out the adjacent segment identifierthat is of the second network node and that is in the second packet, togenerate a third packet, and sends the third packet to a next-hopnetwork node of the second network node within a period of timecorresponding to the cycle time number.

In an example, the first network node may perform the steps performed bythe ingress node in the embodiment shown in FIG. 3 . For detailed stepdescriptions, refer to the embodiment shown in FIG. 3 . The secondnetwork node may perform the steps performed by the intermediate node inthe embodiment shown in FIG. 3 . For detailed step descriptions, referto FIG. 3 .

In an example, after obtaining the first label stack from thecontroller, the first network node may generate, based on the firstlabel stack, a label stack used to forward a packet that is subsequentto the first packet in the service flow. For example, when the firstlabel stack corresponding to the first packet is <SID 2, SID 4>, wherethe SID 2 is the adjacent segment identifier of the first network node,and the SID 4 is the adjacent segment identifier of the second networknode, one adjacent segment identifier of each node is corresponding to aplurality of cycle time numbers. When a packet in the service flow issent based on a duration interval of cycle time, a label stackcorresponding to a first packet that is subsequent to the first packetin the service flow is <SID 3, SID 5>, and a label stack correspondingto a second packet that is subsequent to the first packet in the serviceflow is <SID 4, SID 6>, namely, a label stack of a packet that issubsequent to the first packet generated in a manner of a serial numberof SID plus 1. When a SID of a network node in a label stack changes toa SID 10, a SID of a next label stack changes to a SID 1. In otherwords, SIDs are renumbered at an interval of 10.

In an example, an outbound interface of the first network node iscorresponding to three packet queues, where two packet queues are packetreceiving queues, and one packet queue is a packet sending queue.Referring to FIG. 6 , a packet queue of the first network node at cycletime 1 is in a packet queue status 1; the packet queue at cycle time 2is in a packet queue status 2; and the packet queue at cycle time 3 isin a packet queue status 3. In the packet queue status 1, a queue 1 is asending queue, and a queue 2 and a queue 3 are packet receiving queues.In the packet queue status 2, the queue 2 is the sending queue, and thequeue 1 and the queue 3 are the packet receiving queues. In the packetqueue status 3, the queue 3 is the sending queue, and the queue 1 andthe queue 2 are the packet receiving queues. A packet queue status isalternately switched according to the three statuses in FIG. 6 . Forexample, when a cycle time numbers are 1, 4, 7, 10, and the like, thepacket queue is in the packet queue status 1; when a cycle time numbersare 2, 5, 8, 11, and the like, the packet queue is in the packet queuestatus 2; and when a cycle time numbers are is 3, 6, 9, 12, and thelike, the packet queue is in the packet queue status 3. Each queue iscorresponding to one cycle time sequence. For example, a cycle timesequence of the queue 1 is 1, 4, 7, 10, and the like, a cycle timesequence of the queue 2 is 2, 5, 8, 11, and the like, and a cycle timesequence of the queue 3 is 3, 6, 9, 12, and the like. In other words, acycle time number sequence corresponding to each queue is an arithmeticsequence whose common difference is 3. When the first network nodedetermines that the cycle time for sending the first packet is the cycletime 5, and determines that a current cycle time number of the firstnetwork node is 4, it is determined that a current packet queue statusis the packet queue status 1. The first packet from which the adjacentsegment identifier of the first network node is popped out is added tothe packet queue 2. When the cycle time of the first network nodechanges to the cycle time 5, the packet queue status is in the status 2,and the packet is sent to the second network node through the packetqueue 2.

In an example, an outbound interface of the second network node is alsocorresponding to the three packet queues shown in FIG. 6 , and a changeof the packet queue status is shown in FIG. 6 . When the second networknode receives the second packet at the cycle time 6 of the secondnetwork node, and determines, based on the label stack of the secondpacket, that the second network node needs to send the second packet outat the cycle time 8, the second packet is added to the queue 2. In thiscase, the packet queue status is in the status 3. When a cycle timenumber of the second network node changes to 8, in other words, thepacket queue status is in the status 2, a status of the queue 2 is in apacket sending status. The second network node sends the second packetto a next-hop node of the second network node through the packet queue2.

A plurality of packet queues are set in a network node, to improvereliability of packet forwarding. For example, when a packet arrives atthe second network node, the packet receiving queue of the secondnetwork node is full. In this case, a queue overflow occurs, and thepacket cannot be normally forwarded. A quantity of queues for receivingthe packet is increased, so that the packet may be cached when thepacket arrives at the network node in advance. The packet is sent whencycle time arrives, so that the reliability of packet sending isimproved.

FIG. 7 is a possible schematic structural diagram of a controllerrelated in the foregoing embodiments. The controller 700 may implementfunctions of the controller in the embodiment shown in FIG. 3 or FIG. 5Aand FIG. 5B. Referring to FIG. 7 , the controller 700 includes anobtaining unit 701, a determining unit 702, a processing unit 703, and asending unit 704. These units may perform corresponding functions of thecontroller in the foregoing method embodiment. The obtaining unit 701 isconfigured to support the controller 700 in performing the process S301and the process S302 in FIG. 3 . The determining unit 702 is configuredto support the controller 700 in performing the process S303 and theprocess S306 in FIG. 3 . The sending unit 704 is configured to supportthe controller 700 in performing the process S308 in FIG. 3 . Theprocessing unit 703 is configured to support the controller 700 inperforming the process S307 in FIG. 3 and/or another process performedby the controller in the technology described in this specification. Forexample, the obtaining unit 701 is configured to perform variousinformation obtaining operations performed by the node in the foregoingmethod embodiment. The determining unit 702 is configured to perform thedetermining action performed by the controller in the foregoing methodembodiment. The sending unit 704 is configured to perform variousinformation sending operations performed by the controller in theforegoing method embodiment. The processing unit 703 is configured toperform processing of the controller in the foregoing method embodimentother than the determining action, the information receiving, and theinformation sending. For example, the obtaining unit 701 is configuredto obtain a forwarding latency requirement of a service flow and adestination address of the service flow. The determining unit 702 isconfigured to determine, based on the forwarding latency requirement andthe destination address, a forwarding path for forwarding the serviceflow. A latency of the forwarding path meets the forwarding latencyrequirement of the service flow, and the forwarding path passes througha first network node and a second network node. The first network nodeis an ingress node of the forwarding path, and the second network nodeis an intermediate node of the forwarding path. The determining unit 702is configured to: determine a first cycle time number at which the firstnetwork node forwards a packet and a second cycle time number at whichthe second network node forwards the packet, and determine a firstadjacent segment identifier corresponding to the first cycle time numberand a second adjacent segment identifier corresponding to the secondcycle time number. The packet is a packet in the service flow. Theprocessing unit 703 is configured to generate a label stack of theforwarded packet, where the label stack includes the first adjacentsegment identifier and the second adjacent segment identifier. Thesending unit 704 is configured to send the label stack to the firstnetwork node, where the label stack is used to indicate the firstnetwork node to forward the packet via the forwarding path within aperiod of time corresponding to the first cycle time number. For aspecific execution process, refer to the detailed descriptions ofcorresponding steps in the foregoing embodiment shown in FIG. 3 or FIG.5A and FIG. 5B. Details are not described herein again.

FIG. 8 is a possible schematic structural diagram of a controllerrelated in the foregoing embodiments. The controller 800 includes aprocessor 802, a transceiver 803, a memory 801, and a bus 804. Theprocessor 802, the transceiver 803, and the memory 801 are connected toeach other through the bus 804. The bus 804 may be a peripheralcomponent interconnect (peripheral component interconnect, PCI forshort) bus, an extended industry standard architecture (extendedindustry standard architecture, EISA for short) bus, or the like. Thebus may be classified into an address bus, a data bus, a control bus,and the like. For ease of representation, only one thick line is used torepresent the bus in FIG. 8 , but this does not mean that there is onlyone bus or only one type of bus. The controller 800 may implementfunctions of the controller in the embodiment shown in FIG. 3 or FIG. 5Aand FIG. 5B. The processor 802 and the transceiver 803 may performcorresponding functions of the controller in the foregoing methodexamples. The transceiver 803 is configured to support the controller800 in performing the processes S301 and S302 in FIG. 3 . The processor802 is configured to support the controller 800 in performing theprocess S307 in FIG. 3 and/or another process performed by thecontroller in the technology described in this specification. The memory801 is configured to store program code and data of the controller 800.For a specific execution process, refer to the detailed descriptions ofcorresponding steps in the foregoing embodiment shown in FIG. 3 or FIG.5A and FIG. 5B. Details are not described herein again.

FIG. 9 is a possible schematic structural diagram of a first networknode related in the foregoing embodiments. The first network node mayimplement functions of the ingress node in the embodiment shown in FIG.3 or functions of the first network node in the embodiment shown in FIG.5A and FIG. 5B. Referring to FIG. 9 , the first network node 900includes an obtaining unit 901, a processing unit 902, and a sendingunit 903. These units may perform corresponding functions of the firstnetwork node in the foregoing method examples. The obtaining unit 901 isconfigured to support the first network node 900 in performing theprocess S501 in FIG. 5A and FIG. 5B. The sending unit 903 is configuredto support the first network node 900 in performing the process S502 andthe process S506 in FIG. 5A and FIG. 5B. The processing unit 902 isconfigured to support the first network node 900 in performing theprocess S504 and the process S505 in FIG. 5A and FIG. 5B, and/or anotherprocess performed by the first network node in the technology describedin this specification. For example, the obtaining unit 901 is configuredto perform various information obtaining operations performed by thefirst network node in the foregoing method embodiment. The sending unit903 is configured to perform various information sending operationsperformed by the first network node in the foregoing method embodiment.The processing unit 902 is configured to perform processing of the firstnetwork node in the foregoing method embodiment other than a determiningaction, the information obtaining, the information receiving, and theinformation sending. For example, the obtaining unit 901 is configuredto obtain a packet, and obtain a first label stack based on the packet.The first label stack is a label stack corresponding to a forwardingpath for forwarding the packet, and the first label stack includes anadjacent segment identifier of the first network node and an adjacentsegment identifier of a second network node. The first network node isan ingress node of the forwarding path, and the second network node isan intermediate node of the forwarding path. The processing unit 902 isconfigured to push the first label stack into the packet, where a top ofthe first label stack is the adjacent segment identifier of the firstnetwork node. The processing unit 902 is configured to determine, basedon the adjacent segment identifier of the first network node, a cycletime number at which the packet is forwarded, and pop out the adjacentsegment identifier that is of the first network node and that is in thefirst label stack, to obtain a second label stack. The sending unit 903is configured to send the packet including the second label stack to thesecond network node within a period of time corresponding to the cycletime number. For a specific execution process, refer to the detaileddescriptions of corresponding steps in the foregoing embodiment shown inFIG. 3 or FIG. 5A and FIG. 5B. Details are not described herein again.

It should be noted that, in this embodiment of the present invention,unit division is an example, and is merely a logical function division.In an actual implementation, another division manner may be used.Functional units in the embodiments of the present invention may beintegrated into one processing unit, or each of the units may existalone physically, or two or more units are integrated into one unit. Forexample, in the foregoing embodiment, the receiving unit and the sendingunit may be a same unit or different units. The integrated unit may beimplemented in a form of hardware, or may be implemented in a form of asoftware functional unit.

Referring to FIG. 10 , a first network node 1000 includes a processor1002, a transceiver 1003, a memory 1001, and a bus 1004. The transceiver1003, the processor 1002, and the memory 1001 are connected to eachother through the bus 1004. The bus 1004 may be a PCI bus, an EISA bus,or the like. The bus may be classified into an address bus, a data bus,a control bus, and the like. For ease of representation, only one thickline is used to represent the bus in FIG. 10 , but this does not meanthat there is only one bus or only one type of bus. The first networknode 1000 may implement functions of the ingress node in the embodimentshown in FIG. 3 or functions of the first network node in the embodimentshown in FIG. 5A and FIG. 5B. The processor 1102 and the transceiver1103 may perform corresponding functions of the first network node orcorresponding functions of the ingress node in the foregoing methodexamples. For a specific execution process, refer to the detaileddescriptions of corresponding steps in the foregoing embodiment shown inFIG. 3 or FIG. 5 . Details are not described herein again.

FIG. 11 is a possible schematic structural diagram of a second networknode related in the foregoing embodiments. The second network node mayimplement functions of the ingress node in the embodiment shown in FIG.3 or functions of the second network node in the embodiment shown inFIG. 5A and FIG. 5B. Referring to FIG. 11 , the second network node 1100includes a receiving unit 1101, an obtaining unit 1102, a processingunit 1103, and a sending unit 1104. These units may performcorresponding functions of the second network node or the intermediatenode in the foregoing method examples. The receiving unit 1101 isconfigured to support the second network node 1100 in performing theprocess S506 in FIG. 5A and FIG. 5B. The obtaining unit 1102 isconfigured to support the second network node 1100 in performing theprocess S507 in FIG. 5A and FIG. 5B. The sending unit 1104 is configuredto support the second network node 1100 in performing the process S508in FIG. 5A and FIG. 5B. The processing unit 1103 is configured tosupport the second network node 1100 in performing the process S508 inFIG. 5A and FIG. 5B, and/or another process performed by the secondnetwork node in the technology described in this specification. Forexample, the receiving unit 1101 is configured to perform variousinformation receiving operations performed by the second network node inthe foregoing method embodiment. The obtaining unit 1102 is configuredto perform various information obtaining operations performed by thesecond network node in the foregoing method embodiment. The sending unit1104 is configured to perform various information sending operationsperformed by the second network node in the foregoing method embodiment.The processing unit 1103 is configured to perform processing of thesecond network node in the foregoing method embodiment other than adetermining action, the information obtaining, the information sending,and the information receiving. For example, the receiving unit 1101 isconfigured to receive a first packet sent by a first network node, wherethe packet includes a label stack. The obtaining unit 1102 is configuredto obtain a top of the label stack. The processing unit 1103 isconfigured to: determine that the top of the label stack is an adjacentsegment identifier of the second network device, determine, according toa stored correspondence between an adjacent segment identifier and acycle time, a cycle time corresponding to the adjacent segmentidentifier, and pop out the adjacent segment identifier that is of thesecond network node and that is in the label stack of the first packet,to generate a second packet. The sending unit 1104 is configured to sendthe second packet to a next-hop network node of the first network nodewithin a cycle time corresponding to the adjacent segment identifier.For a specific execution process, refer to the detailed descriptions ofcorresponding steps in the foregoing embodiment shown in FIG. 3 or FIG.5A and FIG. 5B. Details are not described herein again.

It should be noted that, in this embodiment of the present invention,unit division is an example, and is merely a logical function division.In an actual implementation, another division manner may be used.Functional units in the embodiments of the present invention may beintegrated into one processing unit, or each of the units may existalone physically, or two or more units are integrated into one unit. Forexample, in the foregoing embodiment, the receiving unit and the sendingunit may be a same unit or different units. The integrated unit may beimplemented in a form of hardware, or may be implemented in a form of asoftware functional unit.

Referring to FIG. 12 , a second network node 1200 includes a processor1202, a transceiver 1203, a memory 1201, and a bus 1204. The transceiver1203, the processor 1202, and the memory 1201 are connected to eachother through the bus 1204. The bus 1204 may be a PCI bus, an EISA bus,or the like. The bus may be classified into an address bus, a data bus,a control bus, and the like. For ease of representation, only one thickline is used to represent the bus in FIG. 12 , but this does not meanthat there is only one bus or only one type of bus. The second networknode 1200 may implement functions of the intermediate node in theembodiment shown in FIG. 3 or functions of the second network node inthe embodiment shown in FIG. 5A and FIG. 5B. The processor 1202 and thetransceiver 1203 may perform corresponding functions of the secondnetwork node or corresponding functions of the intermediate node in theforegoing method examples. For a specific execution process, refer tothe detailed descriptions of corresponding steps in the foregoingembodiment shown in FIG. 3 or FIG. 5A and FIG. 5B. Details are notdescribed herein again.

Referring to FIG. 13 , an embodiment of the present invention provides apacket sending system 1300. The system 1300 is used to implement thepacket sending method in the foregoing method embodiment. The system1300 includes a controller 1301, a first network node 1302, and a secondnetwork node 1303. The controller 13201, the first network node 1302,and the second network node 1303 may separately implement functions ofthe controller, the first network node, and the second network node inthe embodiment shown in FIG. 3 or FIG. 5A and FIG. 5B. For a specificexecution process, refer to the detailed descriptions of correspondingsteps in the foregoing embodiment shown in FIG. 3 or FIG. 5A and FIG.5B. Details are not described herein again.

An embodiment of the present invention further provides a storagemedium, configured to store a software instruction used in the foregoingembodiments. The software instruction includes a program used to performthe method shown in the foregoing embodiments. When the softwareinstruction is executed on a computer or a device, the computer or thedevice is enabled to perform the method in the foregoing methodembodiment.

“First” in the first network node in the embodiments of the presentinvention is merely used as a name identifier, and does not represent afirst place in sequence. For the words “second” and “third”, this rulealso applies.

It should be noted that any apparatus embodiment described above ismerely an example. The units described as separate parts may or may notbe physically separate, and parts displayed as units may or may not bephysical units, may be located in one position, or may be distributed ona plurality of network units. Some or all the modules may be selectedaccording to actual needs to achieve the objectives of the solutions ofthe embodiments. In addition, in the accompanying drawings of theembodiments of the first network node or the controller provided by thepresent invention, connection relationships between modules indicatethat the modules have communication connections with each other, and thecommunication connection may be specifically implemented as one or morecommunications buses or signal lines. A person of ordinary skill in theart may understand and implement the embodiments of the presentinvention without creative efforts.

Methods or algorithm steps described in combination with the contentdisclosed in the embodiments of the present invention may be implementedby hardware, or may be implemented by a processor by executing asoftware instruction. The software instruction may include acorresponding software module. The software module may be stored in arandom access memory (random access memory, RAM), a flash memory, aread-only memory (read only memory, ROM), an erasable programmableread-only memory (erasable programmable ROM, EPROM), an electricallyerasable programmable read-only memory (Electrically EPROM, EEPROM), ahard disk, a removable hard disk, a compact disc, or any other form ofstorage medium well-known in the art. For example, a storage medium iscoupled to a processor, so that the processor can read information fromthe storage medium or write information into the storage medium.Certainly, the storage medium may be a component of the processor. Theprocessor and the storage medium may be located in an ASIC. In addition,the ASIC may be located in a core network interface device. Certainly,the processor and the storage medium may exist in the core networkinterface device as discrete components.

A person skilled in the art should be aware that in the foregoing one ormore examples, functions described in the present invention may beimplemented by hardware, software, firmware, or any combination thereof.When the present invention is implemented by software, the functions maybe stored in a computer-readable medium or transmitted as one or moreinstructions or code in the computer-readable medium. Thecomputer-readable medium includes a computer storage medium and acommunications medium, where the communications medium includes anymedium that enables a computer program to be transmitted from one placeto another place. The storage medium may be any available mediumaccessible to a general-purpose or special-purpose computer.

The objectives, technical solutions, and benefits of the presentinvention are further described in detail in the foregoing specificimplementations. It should be understood that the foregoing descriptionsare merely specific implementations of the present invention, but arenot intended to limit the protection scope of the present invention. Anymodification, equivalent replacement, or improvement made on the basisof the present invention shall fall within the protection scope of thepresent invention.

1. A controller comprising: one or more memories configured to storeinstructions; and one or more processors coupled to the one or morememories and configured to execute the instructions to cause thecontroller to: determine a forwarding path for forwarding a serviceflow, wherein the forwarding path passes through a first network deviceand a second network device, the first network device is an ingress nodeof the forwarding path, and the second network device is an intermediatenode of the forwarding path; generate a segment identifier (SID) listcorresponding to the forwarding path, wherein the SID list comprises afirst SID and a second SID, the first SID corresponds to a first cyclenumber for sending a packet by the first network device, the second SIDcorresponds to a second cycle number for sending the packet by thesecond network device, and the packet is a packet in the service flow;and send the SID list to the first network device, wherein the SID listis used to indicate to the first network device to forward the packet.2. The controller according to claim 1, wherein the first cycle numberfor sending the packet by the first network device corresponds to afirst time for sending the packet by the first network device, thesecond cycle number for sending the packet by the second network devicecorresponds to a second time for sending the packet by the secondnetwork device.
 3. The controller according to claim 1, wherein the oneor more processors are further configured to execute the instructions tocause the network device to: obtain a first node latency of the firstnetwork device and a second node latency of the second network device,wherein each of the first and second node latencies comprises a packetprocessing latency and a packet sending latency; and obtain a linklatency of a link on the forwarding path.
 4. The controller according toclaim 2, wherein the one or more processors are further configured toexecute the instructions to cause the network device to: obtain a firstnode latency of the first network device and a second node latency ofthe second network device, wherein each of the first and second nodelatencies comprises a packet processing latency and a packet sendinglatency; and obtain a link latency of a link on the forwarding path. 5.The controller according to claim 3, wherein a sum of the first nodelatency, the second node latency, and a link latency of the link on theforwarding path falls within a range of the forwarding latencyrequirement of the service flow.
 6. The controller according to claim 4,wherein a sum of the first node latency, the second node latency, and alink latency of the link on the forwarding path falls within a range ofthe forwarding latency requirement of the service flow.
 7. Thecontroller according to claim 1, wherein the first SID and the secondSID are MPLS labels.
 8. A first network device comprising: one or morememories configured to store instructions; and one or more processorscoupled to the one or more memories and configured to execute theinstructions to cause the first network device to: obtain a segmentidentifier (SID) list corresponding to a forwarding path for forwardinga packet, wherein the SID list comprises a second SID of a secondnetwork device, the first network device is an ingress node of theforwarding path, the second network device is an intermediate node ofthe forwarding path; encapsulate the SID list in the packet; and sendthe packet encapsulating the SID list to the second network device,wherein the second SID indicates a second cycle number for sending thepacket by the second network device.
 9. The network device according toclaim 8, wherein the second SID is a MPLS label.
 10. A first networkdevice comprising: one or more memories configured to storeinstructions; and one or more processors coupled to the one or morememories and configured to execute the instructions to cause the firstnetwork device to: receive a packet sent by a second network devicecomprising a segment identifier (SID) list comprising a SID of the firstnetwork device; determine a SID of the first network device thatindicates a cycle number for sending the packet by the first networkdevice; and send the packet at a time corresponding to the cycle number.11. The network device according to claim 10, wherein the SID of thefirst network device corresponds to an interface of the first networkdevice.
 12. The network device according to claim 11, wherein the one ormore processors are further configured to execute the instructions tocause the network device to: add the packet to a queue corresponding tothe cycle number, and send the packet via the interface corresponding tothe SID of the first network device.
 13. The network device according toclaim 12, wherein the second SID of the first network device is anadjacency SID.